public class enumFun {

    SMALL, MEDIUM, LARGE, EXTRALARGE;

    public String getSize() {

        //这将引用对象SMALL
        switch(this) {
            case SMALL:
                return "小份";

            case MEDIUM:
                return "中份";

            case LARGE:
                return "大份";

            case EXTRALARGE:
                return "超大份";

            default:
                return null;
        }
    }
    public String getPrice(){
        case SMALL:
        return 5;

        case MEDIUM:
        return 7;

        case LARGE:
        return 9;

        case EXTRALARGE:
        return 11;

        default:
        return null;
    }

    public static void main(String[] args) {

        //使用对象SMALL调用方法getSize()
        System.out.println("披萨的大小是 " + Size.SMALL.getSize());
        System.out.println("披萨的价格是 " + Size.SMALL.getPrice());
    }
}

